package com.cqc.startactivityforactivitydmeo;

import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
	

		Button btn1 = (Button) findViewById(R.id.btn1);
		btn1.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(MainActivity.this, BActivity.class);
				intent.putExtra("name", "马云");
				startActivityForResult(intent, 1);
			}
		});
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		Log.d("tag", "onActivityResult=");
		if (requestCode == 1 && resultCode == 2) {
			String age = data.getStringExtra("age");
			Log.d("tag", "age="+age);
		}
		if (requestCode == 1 && resultCode == 3) {
			String coopretion = data.getStringExtra("coopretion");
			Log.d("tag", "coopretion="+coopretion);
		}
	}
}
